Skip to content

GH-492 fix parsing numeric values in FreeTextAnnotation#493

Open
SirFrancix wants to merge 1 commit into
pcorless:mainfrom
SirFrancix:main
Open

GH-492 fix parsing numeric values in FreeTextAnnotation#493
SirFrancix wants to merge 1 commit into
pcorless:mainfrom
SirFrancix:main

Conversation

@SirFrancix
Copy link
Copy Markdown
Contributor

parsing of cssProperty font-size with numeric-only value causes StringIndexOutOfBoundsException

} else if (cssProperty != null && cssProperty.contains("font-size")) {
String fontSize = cssProperty.substring(cssProperty.indexOf(":") + 1).trim();
fontSize = fontSize.substring(0, fontSize.indexOf('p'));
fontSize = fontSize.replaceFirst(".*?(\\d+).*", "$1");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good but maybe we could support decimal number too?

Suggested change
fontSize = fontSize.replaceFirst(".*?(\\d+).*", "$1");
fontSize = fontSize.replaceFirst(".*?(\\d+(?:\\.\\d+)?).*", "$1");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants